<?php
/**
 * Created by PhpStorm.
 * User: haobin
 * Date: 2016/11/15
 * Time: 9:24
 * description: 单个用户的分享详情
 */
require('../conn.php');
require('../functions.php');
require('admin.php');
$page = $_GET['page'];
if (is_numeric($page) == false) {
    $page = 1;
    $page_1 = 1;
    $min = 0;
    $page_2 = $page + 1;
} else {
    if ($page > 1) {
        $page_2 = $page + 1;
        $min = ($page - 1) * 20;
        $page_1 = $page - 1;
    } else {
        $page_1 = 1;
        $min = 0;
        $page_2 = 2;
    }
}
$max = 20;
$uid = $_GET['uid'];
$sql = "select * from sharedata WHERE uid={$uid} AND TYPE != 2 ORDER BY day DESC,time DESC limit $min,$max";
$row = $mysql->query($sql);
echo $sql;
?>
<?php include('head.php') ?>
<div class="container-fluid">
    <div class="row-fluid">
        <?php
        include('left.php'); ?>
        <div class="span9">
            <h1 class="page-title">分享统计</h1>
            <h2><?=$today?></h2>
            <div class="well">
                <div id="myTabContent" class="tab-content">
                    <div class="tab-pane active in" id="home">
                        <div class="well">
                            <div class="pull-right">
                                <a href="?uid=<?=$uid?>&page=<?=$page_1?>">上一页</a>
                                <a href="?uid=<?=$uid?>&page=<?=$page_2?>">下一页</a>
                            </div>
                            <table class="table">
                                <thead>
                                <tr>
                                    <th>#</th>
                                    <th>用户id</th>
                                    <th>文章页</th>
                                    <th>积分</th>
                                    <th>设备</th>
                                    <th>平台</th>
                                    <th>ip</th>
                                    <th>时间</th>
                                </tr>
                                </thead>
                                <tbody>
                                <?php
                                foreach ($row as $tx) {
                                    if($tx['type'] == 1) $tx['money']=0;
                                    $time = $tx['day']." ".$tx['time'];
                                    $article = $mysql->query("select content from news where id={$tx['aid']}");
                                    $content = mb_substr($article[0]['content'],0,20);
                                    print <<<table
        <tr>
          <td>{$tx['id']}</td>
		  <td>{$tx['uid']}</td>
		  <td>{$content}</td>
		  <td>{$tx['money']}</td>
		  <td>{$tx['device']}</td>
		  <td>{$tx['platform']}</td>
		  <td>{$tx['ip']}</td>
		  <td>{$time}</td>
        </tr>
table;
                                } ?>
                                </tbody>
                            </table>
                        </div>
                    </div>
                    <div class="tab-pane fade" id="profile">
                    </div>
                </div>

            </div>

        </div>
    </div>
</div>
<script src="lib/bootstrap/js/bootstrap.js"></script>
</body>
</html>
